﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SerializationDemo
{
    [Serializable]
    public class Person
    {
        [NonSerialized]
        private int _age;

        public int Age
        {
            get
            {
                return _age;
            }
            set
            {
                _age = value;
            }
        }

        public DethDisease Disease
        {
            get;
            set;
        }

        public string Medicine
        {
            get;
            set;
        }

        public Person()
        {
            Age = 0;
        }

        public bool Live()
        {
            Age++;
            if (Disease != null && !Disease.CanLive(Age, Medicine))
                return false;
            return true;
        }
    }
}
